package com.sjp.pojo.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 这个类是用来博客管理页面遍历查询展示的实体类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BlogDto {

    private Integer blogId;
    private String blogTitle;
    private String blogCoverImage;
    private Integer blogCategoryId;
    private String blogCategoryName;
    private String blogTags;
    private Integer blogStatus;
    private Integer blogViews;
    private Date createTime;

    // 获取创建时间---年月日时分秒
    public String getCreateTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(this.createTime);
    }

    // 获取创建时间---年月日
    public String getAboutTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return simpleDateFormat.format(this.createTime);
    }

}
